<?php include("header.php"); ?>

<script type="text/javascript">
    function validate()
	{
	/*
        var email = document.getElementById('email');
        var fullname = document.getElementById('fullname');
		var indentify = document.getElementById('indentify');
        var username = document.getElementById('username');
        var sex = document.getElementById('sex');
        var password = document.getElementById('password');
        var confirm_password = document.getElementById('confirm_password');
		var address = document.getElementById('address');
		var phone = document.getElementById('phone');
		var mobile = document.getElementById('mobile');
		
        if(isEmptyTextBox(fullname, '<?php echo _LB_FULL_NAME_IS_EMPTY; ?>'))
        {
            return false;
        }
        
        if(fullname.value.length > '<?php echo MAX_LENGTH_NAME; ?>')
        {
            showErrorBubble(fullname, '<?php echo _LB_FULL_NAME_IS_TOO_LONG; ?>');
            return false;
        }
        
        if(isEmptyTextBox(username, '<?php echo _LB_NAME_IS_EMPTY; ?>'))
        {
            return false;
        }
        
        if(username.value.length > '<?php echo MAX_LENGTH_NAME; ?>')
        {
            showErrorBubble(username, '<?php echo _LB_NAME_IS_TOO_LONG; ?>');
            return false;
        }
        
        if(isEmptyTextBox(email, '<?php echo _LB_EMAIL_IS_EMPTY; ?>'))
        {
            return false;
        }
        
        if(email.value.length > '<?php echo MAX_LENGTH_NAME; ?>')
        {
            showErrorBubble(email, '<?php echo _LB_EMAIL_IS_TOO_LONG; ?>');
            return false;
        }
        <?php if(!$user->id) { ?>
        if(isEmptyTextBox(password, '<?php echo _LB_INVALID_PASSWORD; ?>'))
        {
            return false;
        }
        
        if(password.value.length > '<?php echo MAX_LENGTH_PASSWORD; ?>')
        {
            showErrorBubble(password, '<?php echo _MSG_PASSWORD_IS_TOO_LONG; ?>');
            return false;
        }
        
        if(password.value.length < '<?php echo MIN_LENGTH_PASSWORD; ?>')
        {
            showErrorBubble(password, '<?php echo _MSG_PASSWORD_IS_TOO_SHORT; ?>');
            return false;
        }
        
        if(isEmptyTextBox(confirm_password, '<?php echo _LB_INVALID_CONFIRM_PASSWORD; ?>'))
        {
            return false;
        }
        
        if (password.value != confirm_password.value) {
            showErrorBubble(confirm_password, '<?php echo _LB_PASSWORD_DOESNT_MATCH; ?>');
            return false;
        }
        <?php } ?>
        if(isEmptyTextBox(sex, '<?php echo _LB_GENDER_IS_EMPTY; ?>'))
        {
            return false;
        }
      */  
		document.user.submit();
	}

</script>

	<div class="one_center">
		<div class="box_two_third">
			<div class="box_head"><?php if ($user->id) { echo _LB_EDIT_MEMBER; } else { echo _LB_ADD_MEMBER; } ?></div>
			<div class="box_content" >
				<form action="" name="user" method="post">
				<input type="hidden" id="id" name="id" value="<?php echo $user->id; ?>"/>
				<input type="hidden" id="act" name="act" value="<?php echo ACT_VALID_EDIT; ?>"/>
				<table cellpadding="0" cellspacing="5px" border="0">
					<tr>
						<td width="20%"><label><?php echo _LB_USERNAME; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></label></td>
                        <td><input name="username" id="username" type="text" size="<?php echo SIZE_NAME; ?>" maxlength="<?php echo MAX_LENGTH_NAME;?>" value="<?php echo $user->username; ?>"/></td>
					</tr>
					<?php if(!$user->id) { ?>
                    <tr>
						<td width="20%"><label><?php echo _LB_PASSWORD; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></label></td>
                        <td><input name="password" id="password" type="password" size="<?php echo SIZE_NAME; ?>" maxlength="<?php echo MAX_LENGTH_NAME;?>" /></td>
					</tr>
                    <tr>
						<td width="20%"><label><?php echo _LB_REPEAT_PASSWORD; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></label></td>
                        <td><input name="confirm_password" id="confirm_password" type="password" size="<?php echo SIZE_NAME; ?>" maxlength="<?php echo MAX_LENGTH_NAME;?>" value=""/></td>
					</tr>
                    <?php } ?>
					<tr>
						<td width="20%"><label><?php echo _LB_CARD_PASSPORT; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></label></td>
                        <td><input name="indentify" id="indentify" type="text" size="<?php echo SIZE_NAME; ?>" maxlength="<?php echo MAX_LENGTH_NAME;?>" value="<?php echo $user->indentify; ?>"/></td>
					</tr>
                    <tr>
						<td width="20%"><label><?php echo _LB_FULL_NAME; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></label></td>
                        <td><input name="fullname" id="fullname" type="text" size="<?php echo SIZE_NAME; ?>" maxlength="<?php echo MAX_LENGTH_NAME;?>" value="<?php echo $user->fullname; ?>"/></td>
					</tr>
                    <tr>
                        <td width="40%"><?php echo _LB_GENDER; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></td>
                        <td width="60%">
                            <select name="type" id="type" style="width: 185px;">
                                <option value=""><?php echo _LB_CHOOSE; ?></option>
                                <option value="1" <?php if($user->sex == 1) { ?>selected<?php } ?> ><?php echo _LB_MALE; ?></option>
                                <option value="0" <?php if($user->sex == 0) { ?>selected<?php } ?> ><?php echo _LB_FEMALE; ?></option>
                            </select>
                        </td>
                    </tr>
					<tr>
						<td width="20%"><label><?php echo _LB_DATE_OF_BIRTH; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></label></td>
                        <td>
							<input name="day" id="day" size="2" maxlength="2" style="width:25px;" type="text" value="<?php echo substr($user->birthday, 8, 2); ?>" />
							<input name="month" id="month" size="2" maxlength="2" style="width:25px;" type="text" value="<?php echo substr($user->birthday, 5, 2); ?>"/>
							<input name="year" id="year" size="4" maxlength="4" style="width:45px;" type="text" value="<?php echo substr($user->birthday, 0, 4); ?>"/>
						</td>
					</tr>
					<tr>
						<td></td>
						<td class="hint"><?php echo _LB_DATE_FORMAT_HINT; ?></td>
					</tr>
					<tr>
						<td width="20%"><label><?php echo _LB_EMAIL; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></label></td>
                        <td><input name="email" id="email" type="text" size="<?php echo SIZE_NAME; ?>" maxlength="<?php echo MAX_LENGTH_NAME;?>" value="<?php echo $user->email; ?>"/></td>
					</tr>
					<tr>
						<td width="20%"><label><?php echo _LB_ADDRESS; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></label></td>
                        <td><input name="address" id="address" type="text" size="<?php echo SIZE_NAME; ?>" maxlength="<?php echo MAX_LENGTH_NAME;?>" value="<?php echo $user->address; ?>"/></td>
					</tr>
					<tr>
						<td width="20%"><label><?php echo _LB_PHONE; ?>&nbsp;:&nbsp;</label></td>
                        <td><input name="phone" id="phone" type="text" size="<?php echo SIZE_NAME; ?>" maxlength="<?php echo MAX_LENGTH_NAME;?>" value="<?php echo $user->phone; ?>"/></td>
					</tr>
					<tr>
						<td width="20%"><label><?php echo _LB_MOBILE; ?>&nbsp;:&nbsp;</label></td>
                        <td><input name="mobile" id="mobile" type="text" size="<?php echo SIZE_NAME; ?>" maxlength="<?php echo MAX_LENGTH_NAME;?>" value="<?php echo $user->mobile; ?>"/></td>
					</tr>
                    <tr>
					  	<td class="submit" colspan="2" style="padding-top: 10px;">
							  <a id="auto_port_return" class="tribullet" id="btnReturn" href="<?php echo $backlink; ?>"><?php echo _LB_BACK; ?></a>
							  <a id="auto_port_validate" class="tribullet" href="#" onclick="validate()"><?php echo _LB_VALIDATE; ?></a>
						</td>
					</tr>
				</table>
				</form>
			</div>
		</div>
	</div>

<?php include("footer.php"); ?>

